]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
environment: Add fallback for MetaIdleMonitor::add_idle_watch_full()
authorSebastian Keller <skeller@gnome.org>
Fri, 30 Jan 2026 14:43:09 +0000 (15:43 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 3 Feb 2026 14:30:39 +0000 (14:30 +0000)
This function was only added in the 50 cycle and then backported to
stable releases, so it might not exist in the version of mutter we are
using.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4058>

js/ui/environment.js

index 93e0bdbd0a3b3aae130a326b577f49ef8df749a7..3ebe8e261a327eabf4677cdc57b19afdb5080d3d 100644 (file)
@@ -338,6 +338,20 @@ Clutter.Actor.prototype.toString = function () {
     return St.describe_actor(this);
 };
 
+if (!Meta.IdleMonitor.prototype.add_idle_watch_full) {
+    Meta.IdleMonitorWatchFlags = {
+        NONE: 0,
+        UNINHIBITABLE: 1,
+        START_NOW: 2,
+    };
+
+    Meta.IdleMonitor.prototype.add_idle_watch_full = function (interval, callback, flags = 0) {
+        if (flags !== 0)
+            console.warn('IdleMonitor does not support flags, the watch will not work as expected');
+        this.add_idle_watch(interval, callback);
+    };
+}
+
 Gio.File.prototype.touch_async = function (callback) {
     Shell.util_touch_file_async(this, callback);
 };